Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move typo checks to after_insert #17764

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

di
Copy link
Member

@di di commented Mar 12, 2025

(Marking as draft since this still needs tests).

This is a proof-of-concept to show that we can move the non-blocking project name typo checks to an after_insert mapper event hook, in order to avoid duplicate notifications if project creation is attempted but ends up failing due to various checks.

@di di marked this pull request as ready for review March 13, 2025 14:28
@di di requested a review from a team as a code owner March 13, 2025 14:28
@di di enabled auto-merge (squash) March 13, 2025 14:37
Copy link
Member

@miketheman miketheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally correct. A couple of questions inline.

@@ -496,6 +502,92 @@ def yanked_releases(self):
)


@event.listens_for(Project, "after_insert")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places we use our own @db.listens_for(db.Session, ... - any reason to not use that?

@@ -496,6 +502,92 @@ def yanked_releases(self):
)


@event.listens_for(Project, "after_insert")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first time after_insert is used in warehouse - looking at the docs, it's clarifying that this happens after session flush, not as part of the ORM Insert approach.
How did you validate the notification is still sent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants